1. Field of the Invention
The present invention generally relates to data networks. More specifically, the invention relates to differences in configuration states of routers, switches and other network devices in such data networks.
2. Description of Related Art
For devices such as routers and switches, a configuration state may be represented as a text file known as a “configuration file.” Configuration files may reflect the various hierarchical contexts, such as “modes,” “submodes,” etc., that a router or switch can present. Each context has a specific set of pre-defined commands. Defined commands are valid only within the appropriate hierarchical context, e.g., within a particular mode or submode. Accordingly, such commands are context-specific.
For example, in software developed by Cisco Systems, Inc., there are two top-level modes for routers: “Exec” mode and “Config” mode. Within the configuration mode, there are several defined submodes, which may include sub-submodes, sub-sub-submodes, and so on. For the sake of brevity, all such hierarchical contexts will be referred to herein as “submodes.”
Within each submode there are a number of different commands. Commands within Exec mode are not part of the configuration state of a router. Exemplary commands within Exec mode include “show,” “copy” and “debug.” Commands in Config mode constitute the configuration state of a router. Examples include commands to set up in access lists, hostname, interfaces, etc.
Centralized network management involves configuring, provisioning and managing network elements. A central management application or operator gathers data from network elements in order to derive information to perform these tasks and then downloads configuration commands to one or many network elements to dynamically control the network. Control of the network involves sending one or more commands to network elements. For each command within a set of commands, it is essential that the associated mode or submode be specified so that the command can be applied in the right context. The optimal way of applying a set of configuration changes is by only applying an incremental set of changes, the incremental set being determined for a defined control or measurement interval. Because optimal application is critical in device configuration, it is important to determine the changes or “diffs” between a device's configuration state over a control or measurement interval, e.g. at a first time and at a second time.
With standard and widely used general-purpose diff algorithms, a purely textual diff is generated when two configuration states are compared. Textual diffs have limited utility because the context in which a certain command applies is not carried over. For instance, suppose that the textual diff between two router configurations is “+ ip address 1.1.1.1 255.255.255.0.” If the router has 5 different interfaces, the association of this ip address command with a particular interface is unclear. The only “context” provided by such general-purpose algorithms is optionally to include a specific number of lines above and/or below the textual diff. Because submodes have varying and unpredictable numbers of commands, the resulting textual diff may or may not include the proper submode for the changed, new or missing command. In addition, such algorithms may result in inclusion of lines that have not changed.
The ambiguity of such general-purpose textual diffs does not permit accurate application of commands for controlling a network. Moreover, purely textual diffs are not “programmatic,” in that they cannot be used as a direct input for a machine-level interface without a need to re-parse generated text. Therefore, conventional textual diffs cannot be reliably used as input to an automated process such as a computer program for automatically changing the configuration state of a network device.